<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>POS收单运营管理平台</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<!-- 当前页面样式 -->
<link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
<!-- 当前页面样式 END -->
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type="text/javascript">

	$(document).ready(
			function() {
				$('#sub').click(function(){
					exec();
					$("#queryUserForm").attr("action","<%=basePath%>/terminalList/queryTerminalSN.ct");
					$("#queryUserForm").submit();
				});			
			});

	function addpanel(id,title,html) {
				window.parent.parent.document.getElementById("framemain").contentWindow.addtabs(id,title,html);
			}
    function showPosInfoWindow(tid,mid){
     var ScreenWidth = screen.availWidth ;
     var ScreenHeight = screen.availHeight; 
     var StartX = (ScreenWidth - innerWidth) / 2 ;
     var StartY = (ScreenHeight - innerHeight) / 2 ;
	 var url =  "<%=basePath %>termAgentSn/termSnAgentInit.ct?tid="+tid+"&mid="+mid;
	
	 window.open(url, '终端序列号信息', 'left='+ StartX + ', top='+ StartY + ', Width=' + innerWidth +', height=' + innerHeight + ', resizable=no, scrollbars=yes, status=no, toolbar=no, menubar=no, location=no'); 
	}
    function exec()
	{
		document.getElementById("sub").setAttribute("disabled", "disabled");
	}
</script>
<style type="text/css">
.bindColor{
	color: blue;
}
.freezeThawColor{
	color: red;
}
</style> 


</head>

<body>

		<s:form id="queryUserForm" action="/terminalList/queryTerminalSN.ct" method="post"
			theme="simple">
			<table class="tb">
   			 <tbody>
        		<tr class="tb-line">
            		<td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div></td>
        		</tr>
				<tr class="tb-line">
					<td class="tb-td" colspan="6">
						<div class="tb-h3">
							终端管理
						</div>
					</td>
				</tr>
				<tr class="tb-line">
				 	<td width="12%" style="min-width: 150px" align="right" class="tb-td">
				 	<div class="tb-h4"> 商户名称：</div></td>
						<td class="tb-td">
                		<label class="tb-input-normal"><s:textfield id="merchantName"
								name="searchCondition.merchantName" cssClass="queryWidth" />
								</label>
						</td>
						<td width="12%" style="min-width: 150px" align="right" class="tb-td">
				 	 <div class="tb-h4">商户号：</div></td>
						<td class="tb-td">
                		<label class="tb-input-normal"><s:textfield id="merchantNo"
								name="searchCondition.merchantNo" cssClass="queryWidth" /></label></td>
								
					<%--  <s:if test="#session.session_merchant.roleType==\"03\"||#session.session_merchant.roleType==\"15\" || #session.session_merchant.roleType==\"16\"">
					  <td align="right" width="15%"></td>
					  <td>
		                  <s:hidden name="searchCondition.orgCode" value="%{#session.session_merchant.orgCode}" />
					  </td>
					</s:if>
					<s:else> --%>
					   <td width="12%" style="min-width: 150px" align="right" class="tb-td">
				 	 <div class="tb-h4">所属机构：</div></td>
						<td class="tb-td">
                		<label class="tb-input-normal">
							<s:select cssClass="queryWidth" name="searchCondition.orgCode"
								id="orgCode"
								list="#request.orgList" listKey="InsIdCd" listValue="InsName" />
						</label>
						</td>
					<%-- </s:else> --%>
					 			
						
				</tr>
				
				 <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">状态</div></td>
					   <td class="tb-td">
                <label class="tb-select">
						 <s:select id="flag"  name="searchCondition.flag" list="#{'02':'已解绑','01':'正常','00':'已冻结'}" headerKey="" headerValue="--不限--" cssClass="queryWidth" /> 
		               </label>
		               </td>						 <td align="right" class="tb-td">
                <div class="tb-h4">终端号：</div></td>
						 <td class="tb-td">
                <label class="tb-input-normal"><s:textfield id="tid"
								name="searchCondition.tid" cssClass="queryWidth" />
								</label></td>
								
						<td align="right" class="tb-td">
                <div class="tb-h4">终端SN号：</div></td>
						<td class="tb-td">
                <label class="tb-input-normal"><s:textfield id="terminalSn"
								name="searchCondition.terminalSn" cssClass="queryWidth" /></label></td>
																							
				</tr>				
				<tr>
						<td colspan="6" align="center"><span style="font-color: red"><s:actionerror /></span>
							<span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
				<tr class="tb-line">
            <td class="tb-td line-submit" align="right" colspan="6">
                <label class="tb-input-submit"><input type="button" value="查   询" id="sub"/></label>
				<label class="tb-input-submit"><s:reset value="取  消" /></label></td>
				</tr>
				
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging" colspan="6"><page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/terminalList/queryTerminalSN.ct?currentPage=" />

						</td>
					</tr>
				</s:if>
			</table>
			
			<div class="big-tb">
			<table class="tb" style="width: 100%;">
				<thead>
            	<tr class="tb-line">
                <th class="tb-th" colspan="11"><div class="tb-h3">终端基本信息列表</div></th>
            	</tr>
            	
					<tr class="tb-line bg-gray">
					    <s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
						   <th class="tb-th">所属机构</th>
						 </s:if>
						<th class="tb-th">商户名称</th>
						<th class="tb-th">商户号</th>
						<th class="tb-th">门店名称</th>
						<th class="tb-th">终端号</th>
						<th class="tb-th">终端类型</th>
						<th class="tb-th">终端状态</th>
						<th class="tb-th">终端序列号</th>
						
						<th class="tb-th">操作</th>
					</tr>
					</thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="term">				
							<tr class="tb-line" >							
							<s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
 						       <td class="tb-td">
							     <s:property value="#term.orgCode"/>
							   </td>
						</s:if>
							
							<td class="tb-td">
							 <s:property value="#term.midName"/>
							 
							</td>
							<td class="tb-td">
							 <s:property value="#term.mid"/>
							</td>
							<td class="tb-td">
							 <s:property value="#term.tidName"/>
							</td>
							<td class="tb-td">
							 <s:property value="#term.terTid"/>
							</td>
							<td class="tb-td">
							 <s:property value="#term.tidKind"/>
							</td>
							<td class="tb-td">
							 	<s:property value="#term.flagName"/>	
							</td>
							<td class="tb-td">
							 <s:property value="#term.serialNum"/>
							</td>
							
							<td class="tb-td" align="center">
														
							<s:if test="#session.session_merchant.roleType =='02' || #session.session_merchant.roleType =='03' || #session.session_merchant.roleType =='10' || #session.session_merchant.roleType =='18'
							|| #session.session_merchant.roleType =='16' || #session.session_merchant.roleType =='17'">
								<s:if test="#term.status==\"N\"">								
									<a href="javascript:void(0)" onclick="showPosInfoWindow('<s:property value="#term.terTid"/>','<s:property value="#term.mid"/>')" class="bindColor" id="terms<s:property value="#term.terTid"/><s:property value="#term.mid"/>">
									<s:if test="#term.flag=='01'">
										绑定
									</s:if>
									<s:elseif test="#term.flag=='02'">
										重绑
									</s:elseif>
									</a>
								</s:if>
								<s:else>
									&nbsp;
									<a href="javascript:void(0)" onclick="addpanel('bind','解绑','<%=basePath %>termAgentSn/terminalSnUnbundInit.ct?dealFlag=1&tid=<s:property value='#term.terTid'/>&mid=<s:property value='#term.mid'/>')" class="bindColor">解绑</a>
									&nbsp;								
								</s:else>
							</s:if>
							<s:if test="#term.status==\"Y\"">
							<s:if test=" #session.session_merchant.roleType =='12'|| #session.session_merchant.roleType =='13'">
										<s:if test="#term.flag=='01'">							
	 										<a href="javascript:addpanel('freezeThaw','终端冻结','<%=basePath %>terminalSn/terminalSnJsp.ct?tid=<s:property value='#term.terTid'/>&mid=<s:property value='#term.mid'/>&deal=3')" class="freezeThawColor">冻结</a>
	 									</s:if>
	 									<s:if test="#term.flag=='00'">
	 										<a href="javascript:addpanel('freezeThaw','终端解冻','<%=basePath %>terminalSn/terminalSnJsp.ct?tid=<s:property value='#term.terTid'/>&mid=<s:property value='#term.mid'/>&deal=4')" class="freezeThawColor">解冻</a>
	 									</s:if>
	 								</s:if>
	 						</s:if>
							</td>
							</tr>
						</s:iterator>
				</tbody>
			</table>
	</div>
	</s:form>
	<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>
